/**
 * 
 */
package com.ajaxw.dump;

import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class DumpDict {
	public void dump2screen(String file) throws IOException {
		FileInputStream fis = new FileInputStream(file);
		BufferedInputStream bis = new BufferedInputStream(fis);
		DataInputStream dis = new DataInputStream(bis);

		int termNum = dis.readInt();
		for (int i = 0; i < termNum; i++) {
			/* int val = */dis.readInt();
			int len = dis.readInt();
			byte[] bytes = new byte[len];

			for (int j = 0; j < len; j++) {
				bytes[j] = dis.readByte();
			}

			String term = new String(bytes, "UTF-8");
			System.out.println(term);
		}
		System.out.println("total term number: " + termNum);
	}
}
